public class TestCount {
    public static void main(String[] args) {
        int[] list = {3, 5, 2, 1, 92, 38, 3, 14, 5, 73, 5};
        System.out.println(count(list, 3));   // 2
        System.out.println(count(list, 5));   // 3
        System.out.println(count(list, 42));  // 0
    }

    public static int count(int[] list, int target) {
        int counter = 0;
        for (int i = 0; i < list.length; i++) {
            if (list[i] == target) {
                counter += 1;
            }
        }
        return counter;
    }
}